import 'package:backend.core/core/domain/entities/google_play/google_play_purchased_subscription_transaction_offer_type.dart';
import 'package:backend.purchases/domain/entities/google_play_api/google_play_api_purchased_subscription_offer_type.dart';

abstract class CreateGooglePlayPurchasedSubscriptionTransactionOfferTypeFromApiOne {
  GooglePlayPurchasedSubscriptionTransactionOfferType call({
    required GooglePlayApiPurchasedSubscriptionOfferType apiOfferType,
  });
}

class CreateGooglePlayPurchasedSubscriptionTransactionOfferTypeFromApiOneImpl
    implements CreateGooglePlayPurchasedSubscriptionTransactionOfferTypeFromApiOne {
  const CreateGooglePlayPurchasedSubscriptionTransactionOfferTypeFromApiOneImpl();

  @override
  GooglePlayPurchasedSubscriptionTransactionOfferType call({
    required GooglePlayApiPurchasedSubscriptionOfferType apiOfferType,
  }) {
    switch (apiOfferType) {
      case GooglePlayApiPurchasedSubscriptionOfferType.trialPeriod:
        return GooglePlayPurchasedSubscriptionTransactionOfferType.trialPeriod;
      case GooglePlayApiPurchasedSubscriptionOfferType.promotional:
        return GooglePlayPurchasedSubscriptionTransactionOfferType.promotional;
      case GooglePlayApiPurchasedSubscriptionOfferType.regular:
        return GooglePlayPurchasedSubscriptionTransactionOfferType.regular;
    }
  }
}
